<template >
  <div class="newlist">
    <van-card :thumb="item.img_url"
     v-for="item in newslist"
     :key="item.id" @click="goNewsInfo(item.id)">
      <div slot="title">{{item.title}}</div>
      <div slot="price">点击{{item.click}}次数</div>
    </van-card>
  </div>
</template>

<script >
export default {
  data: () => ({
    newslist: []
  }),

  created () {
    this.getNewsList()
  },
  methods: {
    async getNewsList () {
      const {
        data: { status, message }
      } = await this.$axios.get('api/getnewslist')
      if (status !== 0) this.$Toast(message)
      this.newslist = message
    },
    goNewsInfo (id) {
      this.$router.push('/home/newsinfo/' + id)
    }
  }
}
</script>
<style lang="less" >
a.van-card__thumb {
    position: relative;
    flex: none;
    width: 90px;
    height: 55px;
    margin-right: 8px;
}
div.van-card__content {
   min-height: 55px;
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    /* min-height: 90px; */
}
.van-card__bottom {
  margin-top: 20px;
    line-height: 20px;
}
div.van-card:not(:first-child) {
    margin-top: 2px;
}
</style>
